/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.Beans;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Bone
 */
@Entity
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cheque.findAll", query = "SELECT c FROM Cheque c")})
public class Cheque implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer id;
    private Integer numero;
    @Column(name = "STATUS_CHEQUE")
    private Character statusCheque;
    @Column(name = "DATA_STATUS")
    @Temporal(TemporalType.DATE)
    private Date dataStatus;
    @JoinColumn(name = "ID_TALONARIO_CHEQUE", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private TalonarioCheque idTalonarioCheque;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCheque")
    private List<ChequeEmitido> chequeEmitidoList;

    public Cheque() {
    }

    public Cheque(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getNumero() {
        return numero;
    }

    public void setNumero(Integer numero) {
        this.numero = numero;
    }

    public Character getStatusCheque() {
        return statusCheque;
    }

    public void setStatusCheque(Character statusCheque) {
        this.statusCheque = statusCheque;
    }

    public Date getDataStatus() {
        return dataStatus;
    }

    public void setDataStatus(Date dataStatus) {
        this.dataStatus = dataStatus;
    }

    public TalonarioCheque getIdTalonarioCheque() {
        return idTalonarioCheque;
    }

    public void setIdTalonarioCheque(TalonarioCheque idTalonarioCheque) {
        this.idTalonarioCheque = idTalonarioCheque;
    }

    @XmlTransient
    public List<ChequeEmitido> getChequeEmitidoList() {
        return chequeEmitidoList;
    }

    public void setChequeEmitidoList(List<ChequeEmitido> chequeEmitidoList) {
        this.chequeEmitidoList = chequeEmitidoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cheque)) {
            return false;
        }
        Cheque other = (Cheque) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.Beans.Cheque[ id=" + id + " ]";
    }
    
}
